package com.tomowork.controller;

import com.tomowork.commons.ServerResponse;
import com.tomowork.entity.Dept;
import com.tomowork.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dept/")
public class DeptController {
    @Autowired
    private IDeptService iDeptService ;
    @RequestMapping("/select/all")
    public ServerResponse selectAll(){
        List<Dept> depts = iDeptService.findAll();
        if(depts!=null){
            return ServerResponse.success(depts) ;
        }
        return ServerResponse.fail("未知错误") ;
    }
}
